package com.md.tww.controller;

import com.md.tww.entity.Student;
import com.md.tww.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
public class StudentController {

    @Autowired
    private StudentService studentService;

    public List<Student> selectAllStudent() {
        return studentService.selectAllStudent();
    }

    public Student selectStudentById(int id) {
        return studentService.selectStudentById(id);
    }

    public String updateStudent(Student student) {
        return studentService.updateStudent(student) ? "修改成功" : "修改失败";
    }

    public String insertStudent(Student student) {
        return studentService.insertStudent(student) ? "添加成功" : "添加失败";
    }

    public String deleteStudent(int id) {
        return studentService.deleteStudent(id) ? "删除成功" : "删除失败";
    }
}
